32. Quiz: List Comprehensions
Quiz: Extract First Names
Use a list comprehension to create a new list
first_names
containing just the first names in
names
in lowercase.
Start Quiz:
names = ["Rick Sanchez", "Morty Smith", "Summer Smith", "Jerry Smith", "Beth Smith"]
first_names = # write your list comprehension here
print(first_names)
Quiz: Multiples of Three
Use a list comprehension to create a list
multiples_3
containing the first 20 multiples of 3.
Start Quiz:
multiples_3 = # write your list comprehension here
print(multiples_3)
Quiz: Filter Names by Scores
Use a list comprehension to create a list of names
passed
that only include those that scored at least 65.
Start Quiz:
scores = {
"Rick Sanchez": 70,
"Morty Smith": 35,
"Summer Smith": 82,
"Jerry Smith": 23,
"Beth Smith": 98
}
passed = # write your list comprehension here
print(passed)